#  include  <stdio.h>
int answer(int a,int b);
	int answert(int a,int b);
int main (){

	int sum=0;
	int a,b;
	scanf("%d%c",&a,&b);
	
	sum=answer(a,b);
    int d=answert(a,b);
    printf("%d\n",d);
    printf("%d",sum);
    
	return 0;
}

int answer(int a,int b){int c,d;int sum=0;
	if(b==61){
		sum+=a;return sum;
	}
	for(;;){
		scanf("%d%c",&c,&d);
		if(b==43){sum=a+c;
		}else{sum=a-c;
		}
		if(d==61){return sum;
		}
		a=sum;b=d;
	}
}
	int answert(int a,int b){int c,d;int sum=0;
	if(b==61){
		sum+=a;return sum+1;
	}
	for(;;){
		scanf("%d%c",&c,&d);
		if(b==43){sum=a+c;
		}else{sum=a-c;
		}
		if(d==61){return sum+1;
		}
		a=sum;b=d;
	}
	
}





